<script type="text/javascript">
$(function(){
	var pg = App.soagov.faceImplEdit.ui, pp = pg.params;
	
	var frm = {
		faceName: pg.seek('faceName'),
		impl: pg.seek('impl'),
		version: pg.seek('version')
	}
	function getValues() {
		return {
			impl: frm.impl.val(),
			version: frm.version.val(),
			id: pp.id,
			faceId: pp.faceId
		}
	}
	function setValues(o) {
		frm.faceName.val(o.faceName);
		frm.impl.val(o.impl);
		frm.version.val(o.version);
	}
	function validate(p){
		var x = App.validate, v = App.soagov.validation,
			msg = pg.seek('msg').html('');
		return !x(v.svc.impl, p.impl,msg,'参数') && !x(v.svc.ver, p.version,msg,'版本号');
	}
	pg.find('input').blur(function(){
		var pms = getValues();
 		if (!validate(pms)) {
 			return;
 		}
	});
	pg.seek('ok').click(function (){
		var pms = getValues();
		if (!validate(pms)) {
			return;
		}
		$.post(App.ctx + '/face/impl/save.do', pms, function(rs){
			var ro = mac.eval(rs);
			if (ro.success) {
				pg.callback();
				pg.close();
			} else {
				pg.seek('msg').html(mac.msg(ro.data, ro.params));
			}
		});
	});

	setValues(pp);
});
</script>
<div class="form">
	<div class="item">
		<span class="label">接口名称：</span>
		<input type="text" name="faceName" readOnly disabled />
		<div class="clear"></div>
	</div>
	<div class="item">
		<span class="label">实现类：</span>
		<input type="text" name="impl" /><span class="msg">*</span>
		<div class="clear"></div>
	</div>
	<div class="item">
		<span class="label">版本号：</span>
		<input type="text" name="version" /><span class="msg">*</span>
		<div class="clear"></div>
	</div>
	<div class="item">
		<span class="label">&nbsp;</span>
		<div name="msg" class="msg"></div>
		<div class="clear"></div>
	</div>
	<div class="bottom">
		<button name="ok">保存</button>
	</div>
</div>